package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.CheckGroup;
import com.itheima.vo.CheckGroupVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author jshstart
 * @creat 2020-11-11 19:30
 */
public interface CheckGroupMapper extends BaseMapper<CheckGroup> {
    @Insert("insert into t_checkgroup_checkitem values(null,#{groupId},#{checkitemId})")
    void addGroupItem(@Param("groupId") Integer id, @Param("checkitemId") Integer checkitemId);

    @Select("select tcg.* from t_setmeal_group tsg\n" +
            "join t_check_group tcg on tsg.group_id=tcg.id\n" +
            "where tsg.setmeal_id=#{id};")
    List<CheckGroupVo> findAllGroupBySetmealId(Long id);
//    @Update("update t_check_item set is_delete=#{is_delete} where id=#{id}")
//    int deleteById(CheckItem checkItem);
}
